/**
 * 
 */
package com.probiz.estoresa.order.print;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.lowagie.text.Document;
import com.lowagie.text.pdf.PdfWriter;

/**
 * 备货单打印
 * 
 */
public class PdfView4Picking extends PdfAbstractView {    
	
	public void buildPdfDocument(Map model, Document document,    
            PdfWriter writer, HttpServletRequest request,    
            HttpServletResponse response) throws Exception {  
		
//		BaseFont bf = BaseFont.createFont("STSong-Light",	"UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
//		fontChinese = new Font(bf, 12, Font.NORMAL); 
//		
//		Set<OrderShipment> orderShipments = (Set<OrderShipment>)model.get("orderShipments");
//		int curIndex = 0;
//		int size = orderShipments.size();
//		for(OrderShipment orderShipment: orderShipments){
//			Paragraph p = new Paragraph();
//			PdfPTable table1 = new PdfPTable(new float[]{30, 70});
//			table1.getDefaultCell().setBorderWidth(0);
//			table1.setWidthPercentage(100);
//			table1.addCell(new Phrase(this.getMessage("order.shipment.title")+this.getMessage("common.message.colon")+orderShipment.getDocumentNo(), fontChinese));
//			table1.addCell(new Phrase(this.getMessage("order.shipment.receiver")+this.getMessage("common.message.colon")+orderShipment.getOrderAddress().getFirstname() + " " + orderShipment.getOrderAddress().getLastname(), fontChinese));
//			table1.addCell("\n");
//			table1.addCell("\n");
//			p.add(table1);
//			
//			PdfPTable table = new PdfPTable(new float[]{8, 19, 8, 32, 33});
//			table.setHeaderRows(1);
//			table.setWidthPercentage(98);
//    		
//    		table.addCell(getThCell(this.getMessage("common.message.ordinalNo"))); 
//    		table.addCell(getThCell(this.getMessage("orderSku.productSkuCode"))); 
//    		table.addCell(getThCell(this.getMessage("orderSku.quantity"))); 
//    		table.addCell(getThCell(this.getMessage("orderSku.productName"))); 
//    		table.addCell(getThCell(this.getMessage("orderSku.displaySkuOptions"))); 
//    		
//    		Set<OrderSku> orderSkus = orderShipment.getOrderSkus();
//    		int i = 1;
//    		int skuSize = orderSkus.size();
//    		for(OrderSku orderSku: orderSkus){
//    			boolean lastOne = (i==skuSize);
//    			table.addCell(getTdCell(String.valueOf(i++), lastOne)); 
//	    		table.addCell(getTdCell(orderSku.getProductSkuCode(), lastOne)); 
//	    		table.addCell(getTdCell(orderSku.getQuantity().toString(), lastOne)); 
//	    		table.addCell(getTdCell(orderSku.getProductName(), lastOne)); 
//	    		table.addCell(getTdCell(orderSku.getDisplaySkuOptions(), lastOne)); 
//    		}
//    		
//    		p.add(table);
//    		curIndex++;
//    		if(curIndex<size)
//    			p.add("\n\n");
//    		document.add(p);
//    	}
    }
	
	protected void addPageEventOnDocumentOpen(){
		PdfPageEvent4PickList pageEvent = new PdfPageEvent4PickList();
    	writer.setPageEvent(pageEvent);
	}
	
}